package com.gsafety.libraryktx.activity
import android.content.Context
import android.content.Intent
import android.widget.TextView
import com.gsafety.library.Base.IBaseActivity
import com.gsafety.libraryktx.R
import com.gsafety.libraryktx.base.BaseActivity
import com.gsafety.libraryktx.config.Constant
import kotlinx.android.synthetic.main.common_activity_web.*

/**公共网页浏览
 * @author : lj
 * @date : 2020/8/10 17:33
 */
class CommonWebActivity: BaseActivity() {
    override fun initView() {

    }

    override fun initData() {
        var title=intent.getStringExtra(Constant.Extra_TITLE_KEY)
        var url=intent.getStringExtra(Constant.Extra_PATH_KEY)
        findViewById<TextView>(R.id.title_name).text =title
        web.loadUrl(this,url)

    }

    override fun getLayoutId(): Int {
       return R.layout.common_activity_web
    }

    companion object {
        fun startIntent(ctx: Context, title:String, url:String) {
            val intent = Intent()
            intent.setClass(ctx, CommonWebActivity::class.java)
            intent.putExtra(Constant.Extra_PATH_KEY,url)
            intent.putExtra(Constant.Extra_TITLE_KEY,title)
            ctx.startActivity(intent)
        }
    }
}